package com.yc.model;

import lombok.Builder;
import lombok.Data;

/**
 * @author zwei
 * @create 2024-09-04 16:26
 */
@Data
@Builder        //lombok提供的注解  将当前类生成一个构造器
public class ResponseResult {
    private Integer code;
    private String msg;
    private Object obj;
    public static ResponseResult ok(String msg){
        return ResponseResult.builder().code(1).msg(msg).build();
    }
    public static ResponseResult ok(){
        return ResponseResult.builder().code(1).msg("成功").build();
    }
    public static ResponseResult error(String msg){
        return ResponseResult.builder().code(0).msg(msg).build();
    }
    public static ResponseResult error(){
        return ResponseResult.builder().code(0).msg("失败").build();
    }
    public <T> ResponseResult setData(T obj){
        this.obj=obj;
        return this;
    }
}
